<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'car-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array( 'enctype'=>'multipart/form-data' ),
)); ?>

	<p class="hint">Поля с <span class="required">*</span> обязательны для заполнения.</p>

	<?php echo $form->errorSummary($model); ?>

	<!-- Выбор модели -->
	
	<fieldset id='<?php echo $this->id; ?>'>
		<legend>Бренд или модельный ряд *</legend>
		<?php echo $form->error($model,'model_id'); ?>
		
		<div class='row' id='<?php echo $this->id; ?>_brand'>
			<label for='brand_id'><?php echo Family::model()->getAttributeLabel('brand_id'); ?></label>
			<?php echo CHtml::dropDownList('Car[brand_id]','',array()); ?>
			<img src='/images/loader.gif' class='loader' style='display: none;'>
		</div>
		
		<div class='row' id='<?php echo $this->id; ?>_family' style='display: none;'>
			<label for='family_id'><?php echo Car::model()->getAttributeLabel('family_id'); ?></label>
			<?php echo CHtml::dropDownList('Car[family_id]','',array()); ?>
			<img src='/images/loader.gif' class='loader' style='display: none;'>
		</div>

	</fieldset>
	<?php 	
	Yii::app()->getClientScript()->registerScript(
		$this->id,
		"jQuery('#{$this->id}').catalogSelect({id:'{$this->id}', model_id:'{$model->id}', model:'".get_class($model)."', select: 'family', brandSelect: $('#Car_brand_id'), familySelect: $('#Car_family_id')});"
	);
	?>
	<!-- /Выбор модели -->

	<div class="row">
		<?php echo $form->labelEx($model,'archive'); ?>
		<?php echo $form->dropDownList($model,'archive', Lookup::items('ArchiveStatus')); ?>
		<?php echo $form->error($model,'archive'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'concept'); ?>
		<?php echo $form->checkBox($model,'concept'); ?>
		<?php echo $form->error($model,'concept'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>60)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'alias'); ?>
		<?php echo $form->textField($model,'alias',array('size'=>60,'maxlength'=>60)); ?>
		<?php echo $form->error($model,'alias'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'manufacture_start'); ?>
		<?php
		$this->widget('ext.timepicker.TimePicker', array(
			'id'=>'manufacture_start',
			'model'=>$model,
			'name'=>'manufacture_start',
			'options'=>array(
				'duration'=>'',
				'showTime'=>false,
				'dateFormat'=>'yy-mm-dd',
				'firstDay' => 1,
				'showOn'=>'button',
				'changeMonth'=>true,
				'changeYear'=>true,
			),
		));
		?>
		<?php echo $form->error($model,'manufacture_start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'manufacture_end'); ?>
		<?php
		$this->widget('ext.timepicker.TimePicker', array(
			'id'=>'manufacture_end',
			'model'=>$model,
			'name'=>'manufacture_end',
			'options'=>array(
				'duration'=>'',
				'showTime'=>true,
				'time24h'=>true,
				'dateFormat'=>'yy-mm-dd',
				'firstDay' => 1,
				'stepMinutes'=>5,
				'showOn'=>'button',
				'changeMonth'=>true,
				'changeYear'=>true,
			),
		));
		?>
		<?php echo $form->error($model,'manufacture_end'); ?>
	</div>


	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php
			$this->widget('ext.markitup.EMarkitUp', array(
				'id'=>'description',
				'model'=>$model,
				'name'=>'description',
				'options'=>array(
					'set'=>'markdown',
				),
			));
		?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Добавить' : 'Сохранить'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->